home *** CD-ROM | disk | FTP | other *** search
- Path: atglab.bls.com!Alun.Champion
- From: Alun.Champion@bridge.bst.bls.com (Alun Champion)
- Newsgroups: comp.lang.c++
- Subject: Re: cout stupidity
- Date: 11 Jan 1996 16:02:28 GMT
- Organization: Computer People Inc.
- Distribution: world
- Message-ID: <ALUN.CHAMPION.96Jan11110228@g7240065.bridge.bst.bls.com>
- References: <4d321g$eal@calvin.st-and.ac.uk>
- NNTP-Posting-Host: bstfirewall.bst.bls.com
- In-reply-to: ks2@st-and.ac.uk's message of 11 Jan 1996 13:06:56 GMT
-
- In article <4d321g$eal@calvin.st-and.ac.uk> ks2@st-and.ac.uk (Keith Sibson) writes:
-
- : #include <iostream.h>
-
- : int count=10;
-
- : main()
- : {
- : for(i=0;i<cout;i++) {.....}
- : return(0);
- : }
-
- : Why does this stupidity compile? (BCC 4.5)
-
- : Surely cout is of type ostream? Either there is a dubious operator< that
- : takes an int and ostream, or there is some wacky automatic conversions going
- : on. Does an ostream cast to an int that is the stream position?
-
- The ostream has a
- operator int(void);
- defined on it so one can do
- if (cout) {
- blah...;
- }
-
- Regards
-
- -A.
- --
- | A.Champion |
-